# file=open(r"c:\a.txt","r")
# text=file.read()
# file.close()
# text1=text.replace("python","wrold")
# file=open(r"c:\a.txt","w")
# file.write(text1)
# file.close()

file=open(r"c:\a.txt","w+")
file.write("我爱你python, 我爱你")
text=file.read()
text1=text.replace("python","wrold")
file.write(text1)